GBML manual / Events

region_exit

Runs once, for every instance of this object, when the player leaves a region of a world by arriving in another. Inside it, region_previous() is the region that was left and region_current() the one just entered. It runs just before Region Entered, and not when the game starts, because nothing was left then.

Syntax

region_exit: fires once, on every instance, when the player leaves a region by arriving in another

Description

Runs once, for every instance of this object, when the player leaves a region by arriving in another one. Inside it, region_previous is the region that was left and region_current is the one just entered. It runs just before Region Entered, and not when the game starts, because nothing was left then.

It runs on the same instances as Region Entered: the objects of the part of the world the player has just arrived in, and the ones that crossed with the player. Coming back out of a house into the same region is no change, so nothing runs.

In a long room cut into regions it runs when the object the camera follows walks across a border out of a region, just before Region Entered.

This event is for the Game Boy Advance, like every part of World Mode. On another console it is grayed in the Add Event list.

Example

if (region_previous() == rg_crypt) {
    instance_destroy(self);
}

Takes this object away once the player has left the crypt.

On the GBA

It runs on the same instances as Region Entered: the objects of the part of the world the player has just arrived in and the ones that crossed with the player, after the part has been made.

See also: region_enterregion_exitedregion_previousregion_currentWhat a region does in the game